<div>
    <div ng-if="!vm.hasPermissionOrder">
        您无权访问此页面！
    </div>
    <div ng-if="vm.hasPermissionOrder">

        <!--filter butten-->
        <div>
            <span style="display:inline-block;vertical-align: bottom;">
                <button ng-click="vm.orderFilter(-1);" style="background: gray;color: white;height: 7em;width: 7em;border-radius: 10px;" >全部订单</button>
            </span>
            <span ng-click="vm.orderFilter(1);" style="display:inline-block;vertical-align: bottom;">
                <button style="background: red;color: white;height: 6em;margin-left: -2em;width: 7em;border-radius: 10px;">待付款</button>
            </span>
            <span ng-click="vm.orderFilter(2);" style="display:inline-block;vertical-align: bottom;">
                <button style="background: orange;color: white;height: 5em;width: 7em;margin-left: -2em;border-radius: 10px;">待发货</button>
            </span>
            <span ng-click="vm.orderFilter(3);" style="display:inline-block;vertical-align: bottom;">
                <button style="background: purple;color: white;height: 4em;width: 7em;margin-left: -2em;border-radius: 10px;">已发货</button>
            </span>
            <span ng-click="vm.orderFilter(4);" style="display:inline-block;vertical-align: bottom;">
                <button style="background: green;color: white;height: 3em;width: 7em;margin-left: -2em;border-radius: 10px;">已收货</button>
            </span>
            <span style="display:inline-block;vertical-align: bottom;">
                <label for="showDeleted">显示已删除</label>
                <input id="showDeleted" type="checkbox" ng-model="vm.showDeleted" ng-change="vm.orderFilter(0);">
            </span>
            <span style="display:inline-block;vertical-align: bottom;">
                <button ng-click="vm.refresh();" style="background: cyan;color: white;height: 2em;width: 7em;margin-left: 1em;border-radius: 10px;">刷新</button>
            </span>
        </div>
        <!-- --filter butten-->

        <!--order-->
        <div style="margin-top:2em;" ng-repeat="order in vm.orders" ng-init="order.config={};" >
            <div style="border: 1px solid black;width: 40em;height: 3em;"> 订单ID：{{order.id}}     状态：{{vm.states[order.state]}}     用户ID：{{order.user_id}}     价格：{{order.expect_pay|currency:'￥'}}（含运费）
                <br>时间：{{order.date}}
            </div>

            <!-- send-->
            <div ng-if="order.state == 2" ng-init="order.config.showSend = false">
                <div style="border: 1px solid black;width: 40em;"> 支付ID：{{order.trad_id}}
                    <button ng-click="order.config.showSend = !order.config.showSend;vm.getAddress(order);" style="margin-left: 62%;height: 2em;width: 8em;background: blueviolet;color:white;border-radius: 10px;">发货</button>
                </div>
                <div ng-show="order.config.showSend">
                    <div style="border: 1px solid black;width: 40em;height: 3em;">  地址：{{order.address.province.name}}{{order.address.city.name}}{{order.address.county.DisName}}{{order.address.detail    }}                         邮政编码：{{order.address.postcode}}
                        <br> 收件人：{{order.address.name}}                                                                 电话：{{order.address.phone}}
                    </div>
                    <div style="border: 1px solid black;width: 6em;display:inline-block;vertical-align: bottom;height: 1.5em;"> 快递ID：</div>
                    <input ng-model="order.config.post_id" type="text" style="border: 1px solid black;width: 12em;display:inline-block;vertical-align: bottom;margin-left: -1em;height: 2em;"/>
                    <div style="border: 1px solid black;width: 7em;display:inline-block;vertical-align: bottom;margin-left: -0.5em;height: 1.5em;"> 快递公司：</div>
                    <input ng-model="order.config.post_company" type="text" style="border: 1px solid black;width: 18em;display:inline-block;vertical-align: bottom;margin-left: -1em;height: 2em;"/>
                    <button ng-click="vm.setSend(order);" style="height: 2em;width: 8em;background: orangered;color:white;margin-left: -1em;border-radius: 10px;">确定</button>
                </div>
            </div>
            <div ng-show="order.state>2"  style="border: 1px solid black;width: 40em;height: 2em;"> 快递ID：{{order.post_id}}       快递公司：{{order.post_company}}</div>
            <!-- --send-->

            <!-- products-->
            <div ng-repeat="item in order.items" style="border: 1px solid black;width: 40em;height: 2em;"> 商品ID：{{item.product_id}}     商品名称：{{item.product.name}}     数量：{{item.number}}     留言：{{item.message}}</div>
            <!-- --products-->
        </div>
        <!-- --order-->
    </div>
</div>